package com.yanqu.road.server.channelserver.cmd.xrank.season;

import com.yanqu.road.logic.pb.XRankPb;
import com.yanqu.road.logic.xlogic.rank.season.XSeasonUserRankListModel;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.cross3.activity.XRankProto;
import com.yanqu.road.server.channelserver.cmd.ChannelCommand;
import com.yanqu.road.server.channelserver.logic.ChannelMessageHelper;
import com.yanqu.road.server.channelserver.manager.xrank.ChannelXRankMgr;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.protocol.ChannelProtocol;
import com.yanqu.road.server.protocol.Cross3Protocol;
import com.yanqu.road.utils.YanQuMessageUtils;

@Cmd(code = ChannelProtocol.N_XRANK_REQ_SYNC_SEASON_RANK_LIST, desc = "")
public class XRankReqSyncSeasonRankListCmd extends ChannelCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        XRankProto.ChannelSyncXSeasonUserRankListReqMsg reqMsg = XRankProto.ChannelSyncXSeasonUserRankListReqMsg.parseFrom(packet.getBytes());
        XSeasonUserRankListModel model = ChannelXRankMgr.getSeasonUserRankMap().getUserRankListModel(reqMsg.getSystemId(), reqMsg.getSeasonId(), reqMsg.getType(), reqMsg.getRangeKey());
        XRankProto.XSeasonUserRankListMsg.Builder builder = XRankPb.parseXSeasonUserRankListMsg(reqMsg.getSystemId(), reqMsg.getSeasonId(), reqMsg.getType(), reqMsg.getRangeKey(), model.getRankList(), false);
        YanQuMessage message = YanQuMessageUtils.buildMessage(Cross3Protocol.C3_XRANK_SYNC_SEASON_USER_RANK_FROM_CHANNEL, builder);
        ChannelMessageHelper.sendToChannel(message, reqMsg.getChannelId());
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
    }

    @Override
    public void sendData() {
    }
}
